package com.cysd.ewmxns.sdw_ui.activity

import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import com.cszy.ewmxns.base.BaseVMActivity
import com.cszy.ewmxns.ext.toast

import com.cysd.ewmxns.sdw_viewmodel.MainViewModel
import qrrspeeelild.rqrc0ode.andro0ild.databinding.ActivityFeedBackBinding


class Sdw_FeedBackActivity : BaseVMActivity<MainViewModel, ActivityFeedBackBinding>() {
    private var  isSuggestionEditStatus = false;
    private var  isConnectionEdit = false;
    override fun initView(savedInstanceState: Bundle?) {
        mBinding.mBoxHead.headTitles.text = "用户反馈"
        //mBinding.mBoxHead.headRelative.setBackgroundColor(resources.getColor(R.color.statubar_color))
        mBinding.mBoxBtn.setOnClickListener {
            mBinding.mSuggestionEdit.text.clear()
            mBinding.mConnectionEdit.text.clear()
            toast("提交成功")
            // mBinding.mBoxBtn.setEnabled(false)

        }
        mBinding.mSuggestionEdit.addTextChangedListener(object : TextWatcher {
            override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
            }

            override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
                if(p0?.length!! >0){
                    isSuggestionEditStatus = true
                }else{
                    isSuggestionEditStatus = false
                }
                mBinding.mBoxBtn.setEnabled(isConnectionEdit && isSuggestionEditStatus)
            }

            override fun afterTextChanged(p0: Editable?) {
            }

        })

        mBinding.mConnectionEdit.addTextChangedListener(object : TextWatcher {
            override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {


            }

            override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
                if(p0?.length!! >0){
                    isConnectionEdit = true
                }else{
                    isConnectionEdit = false
                }
                mBinding.mBoxBtn.setEnabled(isConnectionEdit && isSuggestionEditStatus)
            }

            override fun afterTextChanged(p0: Editable?) {
            }

        })

        mBinding.mBoxHead.headBack.setOnClickListener {
            finish()
        }
    }

}